package com.hei.controller;

import com.hei.pojo.Buser;
import com.hei.service.BuserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
@Controller
public class RegisterController {
    @Autowired
    private BuserService buserService;
    @PostMapping("/register")
    public String register(Buser user, Model model){
        if(buserService.isAccount(user)){
            model.addAttribute("msg","用户名已存在");
            return "register";
        }
        buserService.insertUser(user);
        return "login";
    }

}
